/*
 * Copyright (C) 2023 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @addtogroup image
 * @{
 *
 * @brief 提供image接口的访问。
 *
 * @Syscap SystemCapability.Multimedia.Image
 * @since 10
 * @version 2.0
 */

/**
 * @file image_mdk_common.h
 *
 * @brief 声明图像常用的枚举值和结构体。
 *
 * @since 10
 * @version 2.0
 */

#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_COMMON_H_
#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_COMMON_H_
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif
#define IMAGE_RESULT_BASE 62980096
/**
 * @brief 可能被使用的接口返回值的枚举。
 *
 * @since 10
 * @version 2.0
 */
typedef enum {
    IMAGE_RESULT_SUCCESS = 0,                                      // 操作成功
    IMAGE_RESULT_BAD_PARAMETER = -1,                               // 无效参数
    IMAGE_RESULT_IMAGE_RESULT_BASE = IMAGE_RESULT_BASE,            // 操作失败
    IMAGE_RESULT_ERR_IPC = IMAGE_RESULT_BASE + 1,                  // ipc 错误
    IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST = IMAGE_RESULT_BASE + 2,     // 共享内存失败
    IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL = IMAGE_RESULT_BASE + 3, // 共享内存数据异常
    IMAGE_RESULT_DECODE_ABNORMAL = IMAGE_RESULT_BASE + 4,          // 图像解码失败
    IMAGE_RESULT_DATA_ABNORMAL = IMAGE_RESULT_BASE + 5,            // 图像输入数据异常
    IMAGE_RESULT_MALLOC_ABNORMAL = IMAGE_RESULT_BASE + 6,          // 图像内存分配异常
    IMAGE_RESULT_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 7,           // 图像类型不支持
    IMAGE_RESULT_INIT_ABNORMAL = IMAGE_RESULT_BASE + 8,            // 图像初始化失败
    IMAGE_RESULT_GET_DATA_ABNORMAL = IMAGE_RESULT_BASE + 9,        // 图像获取数据错误
    IMAGE_RESULT_TOO_LARGE = IMAGE_RESULT_BASE + 10,               // 图像数据过大
    IMAGE_RESULT_TRANSFORM = IMAGE_RESULT_BASE + 11,               // 图像转换错误
    IMAGE_RESULT_COLOR_CONVERT = IMAGE_RESULT_BASE + 12,           // 图像颜色转换错误
    IMAGE_RESULT_CROP = IMAGE_RESULT_BASE + 13,                    // 裁剪错误
    IMAGE_RESULT_SOURCE_DATA = IMAGE_RESULT_BASE + 14,             // 图像源数据错误
    IMAGE_RESULT_SOURCE_DATA_INCOMPLETE = IMAGE_RESULT_BASE + 15,  // 图像源数据不完整
    IMAGE_RESULT_MISMATCHED_FORMAT = IMAGE_RESULT_BASE + 16,       // 图像格式不匹配
    IMAGE_RESULT_UNKNOWN_FORMAT = IMAGE_RESULT_BASE + 17,          // 图像未知格式
    IMAGE_RESULT_SOURCE_UNRESOLVED = IMAGE_RESULT_BASE + 18,       // 图像源未解析
    IMAGE_RESULT_INVALID_PARAMETER = IMAGE_RESULT_BASE + 19,       // 图像无效参数
    IMAGE_RESULT_DECODE_FAILED = IMAGE_RESULT_BASE + 20,           // 解码失败
    IMAGE_RESULT_PLUGIN_REGISTER_FAILED = IMAGE_RESULT_BASE + 21,  // 注册插件失败
    IMAGE_RESULT_PLUGIN_CREATE_FAILED = IMAGE_RESULT_BASE + 22,    // 创建插件失败
    IMAGE_RESULT_ENCODE_FAILED = IMAGE_RESULT_BASE + 23,           // 图像编码失败
    IMAGE_RESULT_ADD_PIXEL_MAP_FAILED = IMAGE_RESULT_BASE + 24,    // 图像添加像素位图失败
    IMAGE_RESULT_HW_DECODE_UNSUPPORT = IMAGE_RESULT_BASE + 25,     // 图像硬解码不支持
    IMAGE_RESULT_DECODE_HEAD_ABNORMAL = IMAGE_RESULT_BASE + 26,    // 图像头解码失败
    IMAGE_RESULT_DECODE_EXIF_UNSUPPORT = IMAGE_RESULT_BASE + 27,   // 图像解码EXIF不支持
    IMAGE_RESULT_PROPERTY_NOT_EXIST = IMAGE_RESULT_BASE + 28,      // 图像属性不存在

    IMAGE_RESULT_MEDIA_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 30,               // 媒体类型不支持
    IMAGE_RESULT_MEDIA_TOO_LARGE = IMAGE_RESULT_BASE + 31,                    // 媒体数据过大
    IMAGE_RESULT_MEDIA_MALLOC_FAILED = IMAGE_RESULT_BASE + 32,                // 媒体分配内存失败
    IMAGE_RESULT_MEDIA_END_OF_STREAM = IMAGE_RESULT_BASE + 33,                // 媒体数据流结束失败
    IMAGE_RESULT_MEDIA_IO_ABNORMAL = IMAGE_RESULT_BASE + 34,                  // 媒体输入输出流异常
    IMAGE_RESULT_MEDIA_MALFORMED = IMAGE_RESULT_BASE + 35,                    // 媒体功能异常
    IMAGE_RESULT_MEDIA_BUFFER_TOO_SMALL = IMAGE_RESULT_BASE + 36,             // 媒体数据过小错误
    IMAGE_RESULT_MEDIA_OUT_OF_RANGE = IMAGE_RESULT_BASE + 37,                 // 媒体超出范围错误
    IMAGE_RESULT_MEDIA_STATUS_ABNORMAL = IMAGE_RESULT_BASE + 38,              // 媒体状态异常错误
    IMAGE_RESULT_MEDIA_VALUE_INVALID = IMAGE_RESULT_BASE + 39,                // 媒体值无效
    IMAGE_RESULT_MEDIA_NULL_POINTER = IMAGE_RESULT_BASE + 40,                 // 媒体操作失败
    IMAGE_RESULT_MEDIA_INVALID_OPERATION = IMAGE_RESULT_BASE + 41,            // 媒体操作无效
    IMAGE_RESULT_MEDIA_ERR_PLAYER_NOT_INIT = IMAGE_RESULT_BASE + 42,          // 媒体初始化异常
    IMAGE_RESULT_MEDIA_EARLY_PREPARE = IMAGE_RESULT_BASE + 43,                // 媒体过早预处理
    IMAGE_RESULT_MEDIA_SEEK_ERR = IMAGE_RESULT_BASE + 44,                     // 媒体查找失败
    IMAGE_RESULT_MEDIA_PERMISSION_DENIED = IMAGE_RESULT_BASE + 45,            // 媒体权限拒绝
    IMAGE_RESULT_MEDIA_DEAD_OBJECT = IMAGE_RESULT_BASE + 46,                  // 媒体对象注销
    IMAGE_RESULT_MEDIA_TIMED_OUT = IMAGE_RESULT_BASE + 47,                    // 媒体超时
    IMAGE_RESULT_MEDIA_TRACK_NOT_ALL_SUPPORTED = IMAGE_RESULT_BASE + 48,      // 媒体能力不支持
    IMAGE_RESULT_MEDIA_ADAPTER_INIT_FAILED = IMAGE_RESULT_BASE + 49,          // 媒体适配器初始化失败
    IMAGE_RESULT_MEDIA_WRITE_PARCEL_FAIL = IMAGE_RESULT_BASE + 50,            // 写入parcel失败
    IMAGE_RESULT_MEDIA_READ_PARCEL_FAIL = IMAGE_RESULT_BASE + 51,             // 读取parcel失败
    IMAGE_RESULT_MEDIA_NO_AVAIL_BUFFER = IMAGE_RESULT_BASE + 52,              // 无效数据
    IMAGE_RESULT_MEDIA_INVALID_PARAM = IMAGE_RESULT_BASE + 53,                // 媒体接口发现无效参数
    IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 54,      // 媒体代码适配器不存在
    IMAGE_RESULT_MEDIA_CREATE_CODEC_ADAPTER_FAILED = IMAGE_RESULT_BASE + 55,  // 媒体创建代码适配器失败
    IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 56,       // 媒体代码适配器未初始化
    IMAGE_RESULT_MEDIA_ZCODEC_CREATE_FAILED = IMAGE_RESULT_BASE + 57,         // 媒体代码创建失败
    IMAGE_RESULT_MEDIA_ZCODEC_NOT_EXIST = IMAGE_RESULT_BASE + 58,             // 媒体代码不存在
    IMAGE_RESULT_MEDIA_JNI_CLASS_NOT_EXIST = IMAGE_RESULT_BASE + 59,          // 媒体JNI层类不存在
    IMAGE_RESULT_MEDIA_JNI_METHOD_NOT_EXIST = IMAGE_RESULT_BASE + 60,         // 媒体JNI层方法不存在
    IMAGE_RESULT_MEDIA_JNI_NEW_OBJ_FAILED = IMAGE_RESULT_BASE + 61,           // 媒体JNI层创建对象失败
    IMAGE_RESULT_MEDIA_JNI_COMMON_ERROR = IMAGE_RESULT_BASE + 62,             // 媒体JNI层异常
    IMAGE_RESULT_MEDIA_DISTRIBUTE_NOT_SUPPORT = IMAGE_RESULT_BASE + 63,       // 媒体不支持分布
    IMAGE_RESULT_MEDIA_SOURCE_NOT_SET = IMAGE_RESULT_BASE + 64,               // 媒体源未设置
    IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 65,        // 媒体rtsp适配器未初始化
    IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 66,       // 媒体rtsp适配器不存在
    IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT = IMAGE_RESULT_BASE + 67,       // 媒体不支持rtsp surface
    IMAGE_RESULT_MEDIA_RTSP_CAPTURE_NOT_INIT = IMAGE_RESULT_BASE + 68,        // 媒体rtsp capture初始化失败
    IMAGE_RESULT_MEDIA_RTSP_SOURCE_URL_INVALID = IMAGE_RESULT_BASE + 69,      // 媒体rtsp源路径无效
    IMAGE_RESULT_MEDIA_RTSP_VIDEO_TRACK_NOT_FOUND = IMAGE_RESULT_BASE + 70,   // 媒体rtsp未发现视频能力
    IMAGE_RESULT_MEDIA_RTSP_CAMERA_NUM_REACH_MAX = IMAGE_RESULT_BASE + 71,    // rtsp相机数量达到最大数量
    IMAGE_RESULT_MEDIA_SET_VOLUME = IMAGE_RESULT_BASE + 72,                   // 媒体设置卷失败
    IMAGE_RESULT_MEDIA_NUMBER_OVERFLOW = IMAGE_RESULT_BASE + 73,              // 媒体操作次数溢出
    IMAGE_RESULT_MEDIA_DIS_PLAYER_UNSUPPORTED = IMAGE_RESULT_BASE + 74,       // 媒体分布式播放器不支持
    IMAGE_RESULT_MEDIA_DENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 75,           // 图像解码ICC失败
    IMAGE_RESULT_MEDIA_ENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 76,            // 图像编码CC失败

    IMAGE_RESULT_MEDIA_READ_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 150,        // 读取像素位图失败
    IMAGE_RESULT_MEDIA_WRITE_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 151,       // 写入像素位图失败
    IMAGE_RESULT_MEDIA_PIXELMAP_NOT_ALLOW_MODIFY = IMAGE_RESULT_BASE + 152,   // 像素位图不允许修改
    IMAGE_RESULT_MEDIA_CONFIG_FAILED = IMAGE_RESULT_BASE + 153,               // 配置失败
    IMAGE_RESULT_JNI_ENV_ABNORMAL = IMAGE_RESULT_BASE + 154,                  // JNI环境异常
    IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED = IMAGE_RESULT_BASE + 155,     // surface申请内存失败
    IMAGE_RESULT_CREATE_SURFACE_FAILED = IMAGE_RESULT_BASE + 156,             // 创建surface失败
    IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED = IMAGE_RESULT_BASE + 157,      // 从surface获取参数失败
    IMAGE_RESULT_GET_SURFACE_FAILED = IMAGE_RESULT_BASE + 158,                // 获取sufrace失败
    IMAGE_RESULT_SURFACE_ACQUIRE_BUFFER_FAILED = IMAGE_RESULT_BASE + 159,     // 申请内存失败
    IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED = IMAGE_RESULT_BASE + 160,     // 申请内存失败
    IMAGE_RESULT_REGISTER_LISTENER_FAILED = IMAGE_RESULT_BASE + 161,          // 注册监听失败
    IMAGE_RESULT_REGISTER_BUFFER_FAILED = IMAGE_RESULT_BASE + 162,            // 注册内存失败
    IMAGE_RESULT_FREAD_FAILED = IMAGE_RESULT_BASE + 163,                      // 读取文件失败
    IMAGE_RESULT_PEEK_FAILED = IMAGE_RESULT_BASE + 164,                       // 检测文件失败
    IMAGE_RESULT_SEEK_FAILED = IMAGE_RESULT_BASE + 165,                       // 查找文件失败
    IMAGE_RESULT_STREAM_SIZE_ERROR = IMAGE_RESULT_BASE + 166,                 // 数据流损坏
    IMAGE_RESULT_FILE_FD_ERROR = IMAGE_RESULT_BASE + 167,                     // 文件描述符损坏
    IMAGE_RESULT_FILE_DAMAGED = IMAGE_RESULT_BASE + 168,                      // 文件损坏
    IMAGE_RESULT_CREATE_DECODER_FAILED = IMAGE_RESULT_BASE + 169,             // 创建解码失败
    IMAGE_RESULT_CREATE_ENCODER_FAILED = IMAGE_RESULT_BASE + 170,             // 创建编码失败
    IMAGE_RESULT_CHECK_FORMAT_ERROR = IMAGE_RESULT_BASE + 171,                // 检查格式失败
    IMAGE_RESULT_THIRDPART_SKIA_ERROR = IMAGE_RESULT_BASE + 172,              // skia解码失败
    IMAGE_RESULT_HW_DECODE_FAILED = IMAGE_RESULT_BASE + 173,                  // 硬解码失败
    IMAGE_RESULT_ALLOCATER_TYPE_ERROR = IMAGE_RESULT_BASE + 174,              // 内存类型校验失败
    IMAGE_RESULT_ALPHA_TYPE_ERROR = IMAGE_RESULT_BASE + 175,                  // 透明度类型失败
    IMAGE_RESULT_INDEX_INVALID = IMAGE_RESULT_BASE + 176,                     // 参数无效

    IMAGE_RESULT_MEDIA_UNKNOWN = IMAGE_RESULT_BASE + 200,                     // 媒体未知错误
} IRNdkErrCode;

/**
 * @brief 定义图像大小。
 *
 * @since 10
 * @version 2.0
 */
struct OhosImageSize {
    /** 像素中的图像宽度，用pixels表示 */
    int32_t width;
    /** 像素中的图像高度，用pixels表示 */
    int32_t height;
};

#ifdef __cplusplus
};
#endif
/** @} */
} // namespace Media
} // namespace OHOS
#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_COMMON_H_
